/**
 * Copyright 2009-2010 - YangJiandong(chunquedong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 你可以自由复制、传播本项目的下载包文件，但必须保持其完整性。
 * 我们不用对使用中的风险及由此造成的损失承担任何责任。
 * 详细情况请见《ChunMap许可协议》。

 * 想了解更多有关ChunMap的信息，请访问http://code.google.com/p/chunmap/
 */
package chunmap.raster.grid;

import java.util.ArrayList;
import java.util.List;

import chunmap.data.feature.Raster;
import chunmap.model.elem.Envelope;
import chunmap.raster.grid.data.GridDataSource;

/**
 * 网格
 * 
 * @author chunquedong
 * 
 */
public class Grid implements Comparable<Grid> {
	private double scale;
	private String parameters;

	private GridDataSource gridData;
	private Envelope subEnvelop;//第一个瓦片代表的实际范围。此字段几乎没有什么用。
	private List<Raster> tiles = new ArrayList<Raster>();

	public GridDataSource getGridData() {
		return gridData;
	}

	public void setGridData(GridDataSource gridData) {
		this.gridData = gridData;
	}

	public String getName() {
		String directoryName = parameters + "_" + scale;
		return directoryName;
	}

	public String getParameters() {
		return parameters;
	}

	public void setParameters(String parameters) {
		this.parameters = parameters;
	}

	public List<Raster> getTiles() {
		return tiles;
	}

	public void setTiles(List<Raster> tiles) {
		this.tiles = tiles;
	}

	public double getScale() {
		return scale;
	}

	public void setScale(double scale) {
		this.scale = scale;
	}

	public Envelope getSubEnvelop() {
		return subEnvelop;
	}

	public void setSubEnvelop(Envelope subEnvelop) {
		this.subEnvelop = subEnvelop;
	}

	@Override
	public int compareTo(Grid other) {

		return Double.compare(this.scale, other.getScale());
	}
}
